<template>
	<view class="container">
		<view class="form">
			<view class="title">登录</view>
			<input class="input" v-model="username" type="text" placeholder="请输入用户名" />
			<input class="input" v-model="password" type="password" placeholder="请输入密码" />
			<button class="btn" type="primary"  @click="handleLogin">登录</button>
			<view class="bottom">
				<text>没有账号？</text>
				<navigator class="register-link" url="/pages/register/register">去注册</navigator>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				username:'',
				password:''
			}
		},
		methods: {
			handleLogin() {
				if(!this.username ||!this.password) {
					uni.showToast({
						title:'请输入完整信息',
						icon:'none'
					})
					return
				}
				setTimeout(()=> {
					uni.showToast({
						title:"登录成功",
						icon:'success'
					})
					uni.switchTab({
					
					url:"/pages/CardViewPage/CardViewPage"
				})
				},1000)
				
			}
			
		}
	}
</script>

<style>
.container {
	height: 100vh;
	overflow: hidden;
	display: flex;
	justify-content: center;
	align-items: center;
	background-color: #f5f5f5;
}

.form {
	background-color: white;
	padding: 20px;
	border-radius: 8px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); 
	width: 90%; 
	max-width: 300px; 
}

.title {
	text-align: center;
	margin-bottom: 20px;
	font-size: 24px;
	color: #333;
}

.input {
	display: block;
	width: 90%;
	padding: 10px;
	margin-bottom: 15px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 16px;
}

.btn {
		display: block;
		width: 100%;
		
		background-color: #007AFF;
		color: white;
		border: none;
		border-radius: 4px;
		font-size: 18px;
		cursor: pointer;
		margin-top: 20px; 
}

.btn:hover {
	background-color: #0056b3;
}

.bottom {
	display: flex;
	justify-content: center;
	align-items: center;
	margin-top: 20px;
	font-size: 14px;
	color: #666;
}

.register-link {
	color: #007bff;
	cursor: pointer;
}


</style>
